package com.lantosec.hmrp.modules.report.controller;

import com.lantosec.hmrp.core.kit.PageVO;
import com.lantosec.hmrp.core.kit.Result;
import com.lantosec.hmrp.modules.report.service.IWindIndexService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@Api(value = "行风指标监控控制器", tags = "行风指标监控控制器")
@RestController
@RequestMapping("/report/wind/index")
@Log4j2
public class WindIndexController {

    @Autowired
    private IWindIndexService iWindIndexService;

    @GetMapping("getClinicDeptInfoMonitor")
    @ApiOperation(value = "门诊科室业务信息监控(1)")
    public Result<PageVO<Map<String, Object>>> getClinicDeptInfoMonitor(@ApiParam(value = "分页", required = true) PageVO<Map<String, Object>> page,
                                                                        @ApiParam(value = "开始时间") @RequestParam(name = "startTime", required = false) String startTime,
                                                                        @ApiParam(value = "结束时间") @RequestParam(name = "endTime", required = false) String endTime,
                                                                        @ApiParam(value = "科室名称") @RequestParam(name = "deptName", required = false) String deptName,
                                                                        @ApiParam(value = "医生名称") @RequestParam(name = "docName", required = false) String docName,
                                                                        @ApiParam(value = "账期状态", required = true) @RequestParam(name = "dateState") Integer dateState,
                                                                        @ApiParam(value = "科室名称状态", required = true) @RequestParam(name = "deptState") Integer deptState,
                                                                        @ApiParam(value = "医生名称状态", required = true) @RequestParam(name = "docNameState") Integer docNameState) {
        PageVO<Map<String, Object>> data = iWindIndexService.getClinicDeptInfoMonitorList(page, startTime, endTime, deptName, docName, dateState, deptState, docNameState);
        return Result.ok(data);
    }

    @GetMapping("getInnerDeptInfoMonitor")
    @ApiOperation(value = "住院科室业务信息监控(2)")
    public Result<PageVO<Map<String, Object>>> getInnerDeptInfoMonitor(@ApiParam(value = "分页", required = true) PageVO<Map<String, Object>> page,
                                                                       @ApiParam(value = "开始时间") @RequestParam(name = "startTime", required = false) String startTime,
                                                                       @ApiParam(value = "结束时间") @RequestParam(name = "endTime", required = false) String endTime,
                                                                       @ApiParam(value = "科室名称") @RequestParam(name = "deptName", required = false) String deptName,
                                                                       @ApiParam(value = "账期状态", required = true) @RequestParam(name = "dateState") Integer dateState,
                                                                       @ApiParam(value = "科室名称状态", required = true) @RequestParam(name = "deptState") Integer deptState) {
        PageVO<Map<String, Object>> data = iWindIndexService.getInnerDeptInfoMonitorList(page, startTime, endTime, deptName, dateState, deptState);
        return Result.ok(data);
    }

    @GetMapping("getReportDrugFeeRank")
    @ApiOperation(value = "药品费用排名(3)")
    public Result<PageVO<Map<String, Object>>> getReportDrugFeeRank(@ApiParam(value = "分页", required = true) PageVO<Map<String, Object>> page,
                                                                    @ApiParam(value = "开始时间") @RequestParam(name = "startTime", required = false) String startTime,
                                                                    @ApiParam(value = "结束时间") @RequestParam(name = "endTime", required = false) String endTime,
                                                                    @ApiParam(value = "药物名称") @RequestParam(name = "drugName", required = false) String drugName,
                                                                    @ApiParam(value = "账期状态", required = true) @RequestParam(name = "dateState") Integer dateState,
                                                                    @ApiParam(value = "药物信息状态", required = true) @RequestParam(name = "drugSate") Integer drugSate) {
        PageVO<Map<String, Object>> data = iWindIndexService.getReportDrugFeeRank(page, startTime, endTime, drugName, dateState, drugSate);
        return Result.ok(data);
    }

    @GetMapping("getReportAuxDrugFeeRank")
    @ApiOperation(value = "辅助药物排名(4)")
    public Result<PageVO<Map<String, Object>>> getReportAuxDrugFeeRank(@ApiParam(value = "分页", required = true) PageVO<Map<String, Object>> page,
                                                                       @ApiParam(value = "开始时间") @RequestParam(name = "startTime", required = false) String startTime,
                                                                       @ApiParam(value = "结束时间") @RequestParam(name = "endTime", required = false) String endTime,
                                                                       @ApiParam(value = "科室名称") @RequestParam(name = "hisDeptName", required = false) String hisDeptName,
                                                                       @ApiParam(value = "医生名称") @RequestParam(name = "doctorName", required = false) String doctorName,
                                                                       @ApiParam(value = "辅助药名称") @RequestParam(name = "auxDrugName", required = false) String auxDrugName,
                                                                       @ApiParam(value = "账期状态", required = true) @RequestParam(name = "dateState") Integer dateState,
                                                                       @ApiParam(value = "科室名称状态", required = true) @RequestParam(name = "hisDeptState") Integer hisDeptState,
                                                                       @ApiParam(value = "医生名称状态", required = true) @RequestParam(name = "doctorState") Integer doctorState,
                                                                       @ApiParam(value = "辅助药名称状态", required = true) @RequestParam(name = "auxDrugState") Integer auxDrugState) {
        PageVO<Map<String, Object>> data = iWindIndexService.getReportAuxDrugFeeRank(page, startTime, endTime, hisDeptName, doctorName, auxDrugName, dateState, hisDeptState, doctorState, auxDrugState);
        return Result.ok(data);
    }

    @GetMapping("getReportPpiFeeRank")
    @ApiOperation(value = "质子泵抑制剂医师费用排名(5)")
    public Result<PageVO<Map<String, Object>>> getReportPpiFeeRank(@ApiParam(value = "分页", required = true) PageVO<Map<String, Object>> page,
                                                                   @ApiParam(value = "开始时间") @RequestParam(name = "startTime", required = false) String startTime,
                                                                   @ApiParam(value = "结束时间") @RequestParam(name = "endTime", required = false) String endTime,
                                                                   @ApiParam(value = "科室名称") @RequestParam(name = "hisDeptName", required = false) String hisDeptName,
                                                                   @ApiParam(value = "医生名称") @RequestParam(name = "doctorName", required = false) String doctorName,
                                                                   @ApiParam(value = "质子泵抑制剂名称") @RequestParam(name = "ppiName", required = false) String ppiName,
                                                                   @ApiParam(value = "账期状态", required = true) @RequestParam(name = "dateState") Integer dateState,
                                                                   @ApiParam(value = "科室名称状态", required = true) @RequestParam(name = "hisDeptState") Integer hisDeptState,
                                                                   @ApiParam(value = "医生名称状态", required = true) @RequestParam(name = "doctorState") Integer doctorState,
                                                                   @ApiParam(value = "质子泵抑制剂名称状态", required = true) @RequestParam(name = "ppiState") Integer ppiState) {
        PageVO<Map<String, Object>> data = iWindIndexService.getReportPpiFeeRank(page, startTime, endTime, hisDeptName, doctorName, ppiName, dateState, hisDeptState, doctorState, ppiState);
        return Result.ok(data);
    }

    @GetMapping("getReportDoctorDrugFeeRank")
    @ApiOperation(value = "医生药品费用排名(6)")
    public Result<PageVO<Map<String, Object>>> getReportDoctorDrugFeeRank(@ApiParam(value = "分页", required = true) PageVO<Map<String, Object>> page,
                                                                          @ApiParam(value = "开始时间") @RequestParam(name = "startTime", required = false) String startTime,
                                                                          @ApiParam(value = "结束时间") @RequestParam(name = "endTime", required = false) String endTime,
                                                                          @ApiParam(value = "科室名称") @RequestParam(name = "hisDeptName", required = false) String hisDeptName,
                                                                          @ApiParam(value = "医生名称") @RequestParam(name = "doctorName", required = false) String doctorName,
                                                                          @ApiParam(value = "诊疗类型") @RequestParam(name = "diagTreatType", required = false) String diagTreatType,
                                                                          @ApiParam(value = "账期状态", required = true) @RequestParam(name = "dateState") Integer dateState,
                                                                          @ApiParam(value = "科室名称状态", required = true) @RequestParam(name = "hisDeptState") Integer hisDeptState,
                                                                          @ApiParam(value = "医生名称状态", required = true) @RequestParam(name = "doctorState") Integer doctorState,
                                                                          @ApiParam(value = "诊疗类型", required = true) @RequestParam(name = "diagTreatState") Integer diagTreatState) {
        PageVO<Map<String, Object>> data = iWindIndexService.getReportDoctorDrugFeeRank(page, startTime, endTime, hisDeptName, doctorName, diagTreatType, dateState, hisDeptState, doctorState, diagTreatState);
        return Result.ok(data);
    }

    @GetMapping("getReportClinicRefundMonitor")
    @ApiOperation(value = "医疗收费管理(门诊退费监控)")
    public Result<PageVO<Map<String, Object>>> getReportClinicRefundMonitor(@ApiParam(value = "分页", required = true) PageVO<Map<String, Object>> page,
                                                                            @ApiParam(value = "开始时间") @RequestParam(name = "startTime", required = false) String startTime,
                                                                            @ApiParam(value = "结束时间") @RequestParam(name = "endTime", required = false) String endTime,
                                                                            @ApiParam(value = "科室名称") @RequestParam(name = "hisDeptName", required = false) String hisDeptName,
                                                                            @ApiParam(value = "医生名称") @RequestParam(name = "doctorName", required = false) String doctorName,
                                                                            @ApiParam(value = "患者姓名") @RequestParam(name = "patientName", required = false) String patientName,
                                                                            @ApiParam(value = "项目类别") @RequestParam(name = "itemType", required = false) String itemType,
                                                                            @ApiParam(value = "退费项目") @RequestParam(name = "refundItem", required = false) String refundItem,
                                                                            @ApiParam(value = "账期状态", required = true) @RequestParam(name = "dateState") Integer dateState,
                                                                            @ApiParam(value = "科室名称状态", required = true) @RequestParam(name = "hisDeptState") Integer hisDeptState,
                                                                            @ApiParam(value = "医生名称状态", required = true) @RequestParam(name = "doctorState") Integer doctorState,
                                                                            @ApiParam(value = "患者姓名状态", required = true) @RequestParam(name = "patientNameState") Integer patientNameState,
                                                                            @ApiParam(value = "项目类别状态", required = true) @RequestParam(name = "itemTypeState") Integer itemTypeState,
                                                                            @ApiParam(value = "员工号状态", required = true) @RequestParam(name = "handlerState") Integer handlerState,
                                                                            @ApiParam(value = "退费项目状态", required = true) @RequestParam(name = "refundItemState") Integer refundItemState) {
        PageVO<Map<String, Object>> data = iWindIndexService.getReportClinicRefundMonitor(page, startTime, endTime, hisDeptName, doctorName, patientName, itemType, refundItem, dateState, hisDeptState,
                                                                                            doctorState, patientNameState, itemTypeState, handlerState, refundItemState);
        return Result.ok(data);
    }


    @GetMapping("getReportMedicalQualityCore")
    @ApiOperation(value = "医疗质量核心指标(单独一列)")
    public Result<PageVO<Map<String, Object>>> getReportMedicalQualityCore(@ApiParam(value = "分页", required = true) PageVO<Map<String, Object>> page,
                                                                    @ApiParam(value = "开始时间") @RequestParam(name = "startTime", required = false) String startTime,
                                                                    @ApiParam(value = "结束时间") @RequestParam(name = "endTime", required = false) String endTime,
                                                                    @ApiParam(value = "科室名称") @RequestParam(name = "hmrpDeptName", required = false) String hmrpDeptName) {
        PageVO<Map<String, Object>> data = iWindIndexService.getReportMedicalQualityCore(page, startTime, endTime, hmrpDeptName);
        return Result.ok(data);
    }
}
